import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

/// 加载中的弹框
class LoadingDialog extends Dialog {
  const LoadingDialog({
    super.key,
  });

  @override
  Widget build(BuildContext context) {
    final Widget progress = Theme(
      data: ThemeData(
        cupertinoOverrideTheme: const CupertinoThemeData(
          brightness: Brightness.dark, // 局部指定夜间模式，加载圈颜色会设置为白色
        ),
      ),
      child: const CupertinoActivityIndicator(radius: 16.0),
    );

    return Material(
      type: MaterialType.transparency,
      child: Center(
        child: Container(
          height: 88.0,
          width: 88.0,
          alignment: Alignment.center,
          decoration: const ShapeDecoration(
            color: Color(0xFF3A3A3A),
            shape: RoundedRectangleBorder(
              borderRadius: BorderRadius.all(Radius.circular(8.0)),
            ),
          ),
          child: progress,
        ),
      ),
    );
  }
}
